import React from "react";
import "./todo.less";
import { Card } from "antd";
import Index from "../Shoping";
import store from "../redux";

class TodoList extends React.Component {
  componentDidMount() {
    store.subscribe(() => {
      this.forceUpdate();
    });
  }
  render() {
    return (
      <>
        <Card title={<h1>TodoList</h1>} bordered={true} style={{ width: 600 }}>
          <p>Card content</p>
          <p>Card content</p>
          <p>Card content</p>
          <p>{store.getState()}</p>
        </Card>
        <Index showTop={true} showFooter={false} title="首页">
          {{
            con: <h1>sss</h1>,
            txt: "这是个文本111",
            btnClick: () => {
              store.dispatch({ type: "add" });
            },
            btnClickjj: () => {
              store.dispatch({ type: "minus" });
            },
          }}
        </Index>
        <Index showTop={false} showFooter={true} title="主页">
          {{
            con: <h1>s456</h1>,
            txt: "这是个文本",
            btnClick: () => {
              store.dispatch({ type: "add" });
            },
          }}
        </Index>
      </>
    );
  }
}
export default TodoList;
